package com.bms.web;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.bms.Logic;
import com.bms.abstracts.RESTController;

public class SetEventIdController extends RESTController {
	
	private Logic logic;
	
	public void setLogic(Logic logic) {
		this.logic = logic;
	}

	@Override
	protected ModelAndView doGet(HttpServletRequest request,
			HttpServletResponse response) {
		String id = request.getParameter("id");
		String eventId = request.getParameter("eventid");
		try {
			PrintWriter pw = response.getWriter();
			pw.print(logic.setEventId(id,eventId));
			pw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	protected ModelAndView doPost(HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		return null;
	}

}
